<?php

/**
 * Earthquake form base class.
 *
 * @method Earthquake getObject() Returns the current form's model object
 *
 * @package    TMD
 * @subpackage form
 * @author     Thaihosting
 */
abstract class BaseEarthquakeForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'IEARTHQUAKE_ID'    => new sfWidgetFormInputHidden(),
      'SORIGIN'           => new sfWidgetFormInputText(),
      'SORIGIN_ENG'       => new sfWidgetFormInputText(),
      'DTTIME'            => new sfWidgetFormDateTime(),
      'SPROVINCE_REF'     => new sfWidgetFormInputText(),
      'IDIRECTION_REF'    => new sfWidgetFormInputText(),
      'IDISTANCE_REF'     => new sfWidgetFormInputText(),
      'IDEEP_UNDERGROUND' => new sfWidgetFormInputText(),
      'NMAGNITUDE'        => new sfWidgetFormInputText(),
      'ILATITUDE_DEGREE'  => new sfWidgetFormInputText(),
      'ILATITUDE_MINUTE'  => new sfWidgetFormInputText(),
      'ILATITUDE_SECOND'  => new sfWidgetFormInputText(),
      'ILONGITUDE_DEGREE' => new sfWidgetFormInputText(),
      'ILONGITUDE_MINUTE' => new sfWidgetFormInputText(),
      'ILONGITUDE_SECOND' => new sfWidgetFormInputText(),
      'SNOTE'             => new sfWidgetFormTextarea(),
      'SNOTE_ENG'         => new sfWidgetFormTextarea(),
      'STITLE'            => new sfWidgetFormInputText(),
      'STITLE_ENG'        => new sfWidgetFormInputText(),
      'SIMAGE_FILE'       => new sfWidgetFormInputText(),
      'BTMANUAL'          => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'IEARTHQUAKE_ID'    => new sfValidatorChoice(array('choices' => array($this->getObject()->getIearthquakeId()), 'empty_value' => $this->getObject()->getIearthquakeId(), 'required' => false)),
      'SORIGIN'           => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'SORIGIN_ENG'       => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'DTTIME'            => new sfValidatorDateTime(array('required' => false)),
      'SPROVINCE_REF'     => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'IDIRECTION_REF'    => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'IDISTANCE_REF'     => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'IDEEP_UNDERGROUND' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'NMAGNITUDE'        => new sfValidatorNumber(array('required' => false)),
      'ILATITUDE_DEGREE'  => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'ILATITUDE_MINUTE'  => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'ILATITUDE_SECOND'  => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'ILONGITUDE_DEGREE' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'ILONGITUDE_MINUTE' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'ILONGITUDE_SECOND' => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'SNOTE'             => new sfValidatorString(array('max_length' => 2147483646, 'required' => false)),
      'SNOTE_ENG'         => new sfValidatorString(array('max_length' => 2147483646, 'required' => false)),
      'STITLE'            => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'STITLE_ENG'        => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'SIMAGE_FILE'       => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'BTMANUAL'          => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('earthquake[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Earthquake';
  }


}
